﻿function registroForo(){
 
	var errors="";
	errors += vacio("usuario");
	errors += vacio("clave2");
	errors += vacio("clave");
	errors += vacio("email");
	errors += vacio("captcha");
	errors += claveI();
	errors += claveLarga("clave");
	errors += claveLarga("clave2");
	errors += validaMail();
	if(errors!=""){
		window.alert(errors);
	}
	return errors=="";
}
 function claveI() {
	var result="";
	var ObjClave1= document.getElementById("clave");
	var ObjClave2= document.getElementById("clave2");
	var cla1=ObjClave1.value;
	var cla2=ObjClave2.value;
	
	if(cla1 != cla2){
		result += "Las claves deben coincidir" + "\n";
		document.getElementById("clave").className="errorinput";
		document.getElementById("clave2").className="errorinput";
		}
	else{
		document.getElementById("clave").className="";
		document.getElementById("clave2").className="";
	}
    return result;
  
 }
 function fortalezaPassword()
	{
		var password = document.getElementById("clave").value;
		var result = 0;
		var clave = password;
		//if(clave.match(/[A-Z]+/) && clave.match(/[0-9]+/) && clave.match(/[a-z]+/ && clave.match(/[^A-Za-z0-9]+/))
			//result = 4;
			
			//document.getElementById('force').style="background-color:green;";
			document.getElementById('force').innerHTML="_____________";
			if (clave.match(/^[A-Za-z0-9áéíóú]+$/)){
			result ++;
			document.getElementById('force').innerHTML="_________";
			//document.getElementById('force').style="background-color:yellow;";
			}
			if (clave.match(/^[A-Za-z0-9]+$/)){
			result ++;
			document.getElementById('force').innerHTML="______";
			//document.getElementById('force').style="background-color:red;";
			}
			if (clave.match(/^[A-Za-z]+$/)){
			result ++;
			document.getElementById('force').innerHTML="___";
			//document.getElementById('force').style="background-color:black;";
			}
		
		
			result=4-result;
			//alert(result);
		return result;
	}
